home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: grantp@usa.pipeline.com(Pete Grant)
- Newsgroups: comp.lang.c++
- Subject: Re: Question on writing DLL
- Date: 20 Mar 1996 01:12:13 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4inm1d$88g@news1.h1.usa.pipeline.com>
- References: <4img25$75t@ustsu10.ust.hk>
- NNTP-Posting-Host: 38.8.53.2
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete Grant)
- X-Newsreader: Pipeline v3.5.0
-
- On Mar 19, 1996 14:24:05 in article <Question on writing DLL>,
- 'cs_billy@ug.cs.ust.hk (Ng Ka Fai)' wrote:
-
-
- >
- >Hello all,
- >
- >I am a new learner of DLL and I want to write a testing program on it and
- >call the DLL from a macro of MS-word. However, error message display
- >"Unable to open the specified library" ! What's wrong with it? I suspect
- >that the DLL in Borland C++ (4.5) I written was wrong.
- >Could anyone help me? Please.
- >
- >In macro
- >--------
- >Declare Function Abc Lib "c:\TEST.DLL" () As Integer
- >Sub MAIN
- >a = Abc()
- >MsgBox Str$(a), "TEST"
- >End Sub
- >
- >In DLL
- >------
- >#include <stdio.h>
- >#include <windows.h>
- >
- I assume a 16-bit system.
-
- extern "C"
- >int FAR PASCAL _export Abc()
-
- You need the extern "C" to suppress name mangling.
- PASCAL is necessary to suppress the prepending of
- an underscore and to force the symbol to all upper case.
-
- --
- Pete Grant
- Kalevi, Inc.
- Software Engineering & development
-